From 9dccbfc572398be2e876bcfd02a46c91056113e3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 13 May 2023 07:42:31 -0600 Subject: [PATCH] create a snap of the cli (#1108) * try to build a snap on github. * save artifact * add test and continuous release * permissions * try to get sha into snap * try harder to get sha in * use pre-existing source * debug missing sha * force version into snap instead of sha * shorten version * make version more sortable * avoid dying on info display * pipes vs ors * more work on sha * again sha... --- .github/workflows/ubuntu.yml | 39 +++++++++++++++++++ snap/snapcraft.yaml | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100755 snap/snapcraft.yaml diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ab17eefeb..247cb9c80 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -78,3 +78,42 @@ jobs: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} run: | ./tools/travis_script_linux_coverage + + snap: + name: snap Build + runs-on: ubuntu-latest + outputs: + snap-file: ${{ steps.build-snap.outputs.snap }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build + uses: snapcore/action-build@v1 + id: build-snap + + # Make sure the snap is installable + - name: Test + run: | + sudo snap install --devmode --dangerous ${{ steps.build-snap.outputs.snap }} + export GBTEMP=$(pwd)/gbtemp + mkdir -p "$GBTEMP" + /snap/bin/gpsbabel -D3 || true + ./testo -p /snap/bin/gpsbabel + + - name: Deploy + # This only handles continous releases now, for other events artifacts may be saved in + # the 'Upload Artifacts' step. + if: ( github.event_name == 'push' ) && ( github.ref == 'refs/heads/master' ) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_NAME: Continuous-Linux + run: | + ./tools/uploadtool/upload_github.sh ${{ steps.build-snap.outputs.snap }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build-snap.outputs.snap }} + path: ${{ steps.build-snap.outputs.snap }} + retention-days: 7 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100755 index 000000000..1db316d0f --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,74 @@ +name: gpsbabel # you probably want to 'snapcraft register ' +base: core22 # the base snap is the execution environment for this snap +version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' +summary: "Convert, manipulate and transfer GPS data" +description: | + Convert, manipulate and transfer data from GPS programs or GPS + recievers. Open source and supported on macOS, Windows and Linux. + +license: GPL-2.0 +title: GPSBabel +source-code: https://github.com/GPSBabel/gpsbabel.git +website: https://www.gpsbabel.org + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: devmode # use 'strict' once you have the right plugs and slots + +apps: + gpsbabel: + command: /usr/bin/gpsbabel + +adopt-info: gpsbabel +parts: + gpsbabel: + # See 'snapcraft plugins' + plugin: cmake + cmake-parameters: + - -DCMAKE_BUILD_TYPE=Release + - -DGPSBABEL_WITH_ZLIB=pkgconfig + - -DGPSBABEL_WITH_SHAPELIB=pkgconfig + cmake-generator: Ninja + source: . + override-pull: | + craftctl default + # add install command to CMakeLists.txt + echo "install(TARGETS gpsbabel CONFIGURATIONS Release RUNTIME DESTINATION /usr/bin)" >> CMakeLists.txt + # jam repo sha into GITHUB_SHA + sed -i -e"/GB.SHA/i set(ENV{GITHUB_SHA} \"$(git log -1 --format=%h)\")" gbversion.cmake + # set snap version + # ensure version has at most 32 characters + craftctl set version=$(git log -1 --format='LinuxInstaller-%h-%ad' --date=format:%Y%m%d) + + build-packages: + - git + - vim + - g++ + - ninja-build + - zlib1g-dev + - libshp-dev + - libusb-1.0-0-dev + - pkg-config + - libudev-dev + - qt6-base-dev + - libqt6core5compat6-dev + - libqt6opengl6-dev + - libqt6serialport6-dev + - libqt6webenginecore6-bin + - libgl-dev + - libopengl-dev + - libvulkan-dev + - libx11-xcb-dev + - libxkbcommon-dev + - qt6-l10n-tools + - qt6-tools-dev + - qt6-tools-dev-tools + - qt6-translations-l10n + - qt6-webengine-dev + - qt6-webengine-dev-tools + - qt6-wayland + stage-packages: + - zlib1g + - libshp2 + - libusb-1.0-0 + - libqt6core6 + - libqt6core5compat6 -- 2.30.2